<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Dwifft Struct Reference</title>
    <link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
    <link rel="stylesheet" type="text/css" href="../css/highlight.css" />
    <meta charset='utf-8'>
    <script src="../js/jquery.min.js" defer></script>
    <script src="../js/jazzy.js" defer></script>
    
  </head>
  <body>
    <a name="//apple_ref/swift/Struct/Dwifft" class="dashAnchor"></a>
    <a title="Dwifft Struct Reference"></a>
    <header>
      <div class="content-wrapper">
        <p><a href="../index.html">Dwifft Docs</a> (100% documented)</p>
        <p class="header-right"><a href="https://github.com/jflinter/Dwifft"><img src="../img/gh.png"/>View on GitHub</a></p>
      </div>
    </header>
    <div class="content-wrapper">
      <p id="breadcrumbs">
        <a href="../index.html">Dwifft Reference</a>
        <img id="carat" src="../img/carat.png" />
        Dwifft Struct Reference
      </p>
    </div>
    <div class="content-wrapper">
      <nav class="sidebar">
        <ul class="nav-groups">
          <li class="nav-group-name">
            <a href="../Classes.html">Classes</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="../Classes/CollectionViewDiffCalculator.html">CollectionViewDiffCalculator</a>
              </li>
              <li class="nav-group-task">
                <a href="../Classes/SingleSectionCollectionViewDiffCalculator.html">SingleSectionCollectionViewDiffCalculator</a>
              </li>
              <li class="nav-group-task">
                <a href="../Classes/SingleSectionTableViewDiffCalculator.html">SingleSectionTableViewDiffCalculator</a>
              </li>
              <li class="nav-group-task">
                <a href="../Classes/TableViewDiffCalculator.html">TableViewDiffCalculator</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a href="../Enums.html">Enums</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="../Enums/DiffStep.html">DiffStep</a>
              </li>
              <li class="nav-group-task">
                <a href="../Enums/SectionedDiffStep.html">SectionedDiffStep</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a href="../Extensions.html">Extensions</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="../Extensions/Array.html">Array</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a href="../Structs.html">Structs</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="../Structs/Dwifft.html">Dwifft</a>
              </li>
              <li class="nav-group-task">
                <a href="../Structs/SectionedValues.html">SectionedValues</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a href="../Typealiases.html">Typealiases</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="../Typealiases.html#/s:6Dwifft34SimpleCollectionViewDiffCalculator">SimpleCollectionViewDiffCalculator</a>
              </li>
              <li class="nav-group-task">
                <a href="../Typealiases.html#/s:6Dwifft29SimpleTableViewDiffCalculator">SimpleTableViewDiffCalculator</a>
              </li>
            </ul>
          </li>
        </ul>
      </nav>
      <article class="main-content">
        <section>
          <section class="section">
            <h1>Dwifft</h1>
              <div class="declaration">
                <div class="language">
                  <pre class="highlight"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">Dwifft</span></code></pre>

                </div>
              </div>
            <p>Namespace for the <code>diff</code> and <code>apply</code> functions.</p>

          </section>
          <section class="section task-group-section">
            <div class="task-group">
              <ul>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:ZFV6Dwifft6Dwifft4diffuRxs9EquatablerFTGSax_GSax__GSaGOS_8DiffStepx__"></a>
                    <a name="//apple_ref/swift/Method/diff(_:_:)" class="dashAnchor"></a>
                    <a class="token" href="#/s:ZFV6Dwifft6Dwifft4diffuRxs9EquatablerFTGSax_GSax__GSaGOS_8DiffStepx__">diff(_:_:)</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Returns the sequence of <code><a href="../Enums/DiffStep.html">DiffStep</a></code>s required to transform one array into another.</p>

                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight"><code><span class="kd">public</span> <span class="kd">static</span> <span class="kd">func</span> <span class="n">diff</span><span class="o">&lt;</span><span class="kt">Value</span><span class="p">:</span> <span class="kt">Equatable</span><span class="o">&gt;</span><span class="p">(</span><span class="n">_</span> <span class="nv">lhs</span><span class="p">:</span> <span class="p">[</span><span class="kt">Value</span><span class="p">],</span> <span class="n">_</span> <span class="nv">rhs</span><span class="p">:</span> <span class="p">[</span><span class="kt">Value</span><span class="p">])</span> <span class="o">-&gt;</span> <span class="p">[</span><span class="kt"><a href="../Enums/DiffStep.html">DiffStep</a></span><span class="o">&lt;</span><span class="kt">Value</span><span class="o">&gt;</span><span class="p">]</span></code></pre>

                        </div>
                      </div>
                      <div>
                        <h4>Parameters</h4>
                        <table class="graybox">
                          <tbody>
                            <tr>
                              <td>
                                <code>
                                <em>lhs</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>an array</p>

                                </div>
                              </td>
                            </tr>
                            <tr>
                              <td>
                                <code>
                                <em>rhs</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>another, uh, array</p>

                                </div>
                              </td>
                            </tr>
                          </tbody>
                        </table>
                      </div>
                      <div>
                        <h4>Return Value</h4>
                        <p>the series of transformations that, when applied to <code>lhs</code>, will yield <code>rhs</code>.</p>

                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:ZFV6Dwifft6Dwifft5applyurFT4diffGSaGOS_8DiffStepx__7toArrayGSax__GSax_"></a>
                    <a name="//apple_ref/swift/Method/apply(diff:toArray:)" class="dashAnchor"></a>
                    <a class="token" href="#/s:ZFV6Dwifft6Dwifft5applyurFT4diffGSaGOS_8DiffStepx__7toArrayGSax__GSax_">apply(diff:toArray:)</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Applies a diff to an array. The following should always be true:
Given <code>x: [T], y: [T]</code>, <code>Dwifft.apply(Dwifft.diff(x, y), toArray: x) == y</code></p>

                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight"><code><span class="kd">public</span> <span class="kd">static</span> <span class="kd">func</span> <span class="n">apply</span><span class="o">&lt;</span><span class="kt">Value</span><span class="o">&gt;</span><span class="p">(</span><span class="nv">diff</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Enums/DiffStep.html">DiffStep</a></span><span class="o">&lt;</span><span class="kt">Value</span><span class="o">&gt;</span><span class="p">],</span> <span class="n">toArray</span> <span class="nv">lhs</span><span class="p">:</span> <span class="p">[</span><span class="kt">Value</span><span class="p">])</span> <span class="o">-&gt;</span> <span class="p">[</span><span class="kt">Value</span><span class="p">]</span></code></pre>

                        </div>
                      </div>
                      <div>
                        <h4>Parameters</h4>
                        <table class="graybox">
                          <tbody>
                            <tr>
                              <td>
                                <code>
                                <em>diff</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>a diff, as computed by calling <code>Dwifft.diff</code>. Note that you  be careful to not modify said diff before applying it, and to only apply it to the left hand side of a previous call to <code>Dwifft.diff</code>. If not, this can (and probably will) trigger an array out of bounds exception.</p>

                                </div>
                              </td>
                            </tr>
                            <tr>
                              <td>
                                <code>
                                <em>lhs</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>an array.</p>

                                </div>
                              </td>
                            </tr>
                          </tbody>
                        </table>
                      </div>
                      <div>
                        <h4>Return Value</h4>
                        <p><code>lhs</code>, transformed by <code>diff</code>.</p>

                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:ZFV6Dwifft6Dwifft4diffu0_Rxs9Equatable_S1_rFT3lhsGVS_15SectionedValuesxq__3rhsGS2_xq___GSaGOS_17SectionedDiffStepxq___"></a>
                    <a name="//apple_ref/swift/Method/diff(lhs:rhs:)" class="dashAnchor"></a>
                    <a class="token" href="#/s:ZFV6Dwifft6Dwifft4diffu0_Rxs9Equatable_S1_rFT3lhsGVS_15SectionedValuesxq__3rhsGS2_xq___GSaGOS_17SectionedDiffStepxq___">diff(lhs:rhs:)</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Returns the sequence of <code><a href="../Enums/SectionedDiffStep.html">SectionedDiffStep</a></code>s required to transform one <code><a href="../Structs/SectionedValues.html">SectionedValues</a></code> into another.</p>

                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight"><code><span class="kd">public</span> <span class="kd">static</span> <span class="kd">func</span> <span class="n">diff</span><span class="o">&lt;</span><span class="kt">Section</span><span class="p">:</span> <span class="kt">Equatable</span><span class="p">,</span> <span class="kt">Value</span><span class="p">:</span> <span class="kt">Equatable</span><span class="o">&gt;</span><span class="p">(</span><span class="nv">lhs</span><span class="p">:</span> <span class="kt"><a href="../Structs/SectionedValues.html">SectionedValues</a></span><span class="o">&lt;</span><span class="kt">Section</span><span class="p">,</span> <span class="kt">Value</span><span class="o">&gt;</span><span class="p">,</span> <span class="nv">rhs</span><span class="p">:</span> <span class="kt"><a href="../Structs/SectionedValues.html">SectionedValues</a></span><span class="o">&lt;</span><span class="kt">Section</span><span class="p">,</span> <span class="kt">Value</span><span class="o">&gt;</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="p">[</span><span class="kt"><a href="../Enums/SectionedDiffStep.html">SectionedDiffStep</a></span><span class="o">&lt;</span><span class="kt">Section</span><span class="p">,</span> <span class="kt">Value</span><span class="o">&gt;</span><span class="p">]</span></code></pre>

                        </div>
                      </div>
                      <div>
                        <h4>Parameters</h4>
                        <table class="graybox">
                          <tbody>
                            <tr>
                              <td>
                                <code>
                                <em>lhs</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>a <code>SectionedValues</code></p>

                                </div>
                              </td>
                            </tr>
                            <tr>
                              <td>
                                <code>
                                <em>rhs</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>another, uh, <code>SectionedValues</code></p>

                                </div>
                              </td>
                            </tr>
                          </tbody>
                        </table>
                      </div>
                      <div>
                        <h4>Return Value</h4>
                        <p>the series of transformations that, when applied to <code>lhs</code>, will yield <code>rhs</code>.</p>

                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:ZFV6Dwifft6Dwifft5applyu0_Rxs9Equatable_S1_rFT4diffGSaGOS_17SectionedDiffStepxq___17toSectionedValuesGVS_15SectionedValuesxq___GS3_xq__"></a>
                    <a name="//apple_ref/swift/Method/apply(diff:toSectionedValues:)" class="dashAnchor"></a>
                    <a class="token" href="#/s:ZFV6Dwifft6Dwifft5applyu0_Rxs9Equatable_S1_rFT4diffGSaGOS_17SectionedDiffStepxq___17toSectionedValuesGVS_15SectionedValuesxq___GS3_xq__">apply(diff:toSectionedValues:)</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Applies a diff to a <code><a href="../Structs/SectionedValues.html">SectionedValues</a></code>. The following should always be true:
Given <code>x: SectionedValues&lt;S,T&gt;, y: SectionedValues&lt;S,T&gt;</code>,
<code>Dwifft.apply(Dwifft.diff(lhs: x, rhs: y), toSectionedValues: x) == y</code></p>

                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight"><code><span class="kd">public</span> <span class="kd">static</span> <span class="kd">func</span> <span class="n">apply</span><span class="o">&lt;</span><span class="kt">Section</span><span class="p">,</span> <span class="kt">Value</span><span class="o">&gt;</span><span class="p">(</span><span class="nv">diff</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Enums/SectionedDiffStep.html">SectionedDiffStep</a></span><span class="o">&lt;</span><span class="kt">Section</span><span class="p">,</span> <span class="kt">Value</span><span class="o">&gt;</span><span class="p">],</span> <span class="n">toSectionedValues</span> <span class="nv">lhs</span><span class="p">:</span> <span class="kt"><a href="../Structs/SectionedValues.html">SectionedValues</a></span><span class="o">&lt;</span><span class="kt">Section</span><span class="p">,</span> <span class="kt">Value</span><span class="o">&gt;</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt"><a href="../Structs/SectionedValues.html">SectionedValues</a></span><span class="o">&lt;</span><span class="kt">Section</span><span class="p">,</span> <span class="kt">Value</span><span class="o">&gt;</span></code></pre>

                        </div>
                      </div>
                      <div>
                        <h4>Parameters</h4>
                        <table class="graybox">
                          <tbody>
                            <tr>
                              <td>
                                <code>
                                <em>diff</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>a diff, as computed by calling <code>Dwifft.diff</code>. Note that you  be careful to not modify said diff before applying it, and to only apply it to the left hand side of a previous call to <code>Dwifft.diff</code>. If not, this can (and probably will) trigger an array out of bounds exception.</p>

                                </div>
                              </td>
                            </tr>
                            <tr>
                              <td>
                                <code>
                                <em>lhs</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>a <code>SectionedValues</code>.</p>

                                </div>
                              </td>
                            </tr>
                          </tbody>
                        </table>
                      </div>
                      <div>
                        <h4>Return Value</h4>
                        <p><code>lhs</code>, transformed by <code>diff</code>.</p>

                      </div>
                    </section>
                  </div>
                </li>
              </ul>
            </div>
          </section>
        </section>
        <section id="footer">
          <p>&copy; 2017 <a class="link" href="https://jackflintermann.com" target="_blank" rel="external">Jack</a>. All rights reserved. (Last updated: 2017-04-14)</p>
          <p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.7.5</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
        </section>
      </article>
    </div>
  </body>
</div>
</html>
